<?php /*a:2:{s:55:"E:\code\jiaoyou\application\admin\view\index\index.html";i:1598939753;s:67:"E:\code\jiaoyou\application\admin\view\public\customer_service.html";i:1600250202;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>后台系统<?php if(sysConfig('site_name')): ?> · <?php echo sysConfig('site_name'); ?><?php endif; ?></title>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link rel="shortcut icon" href="http://jiaoyou.com\/style/admin/img/favicon.ico">
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/animate.min.css" />
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/style.min.css" />
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <span><img alt="image" class="img-circle" src="http://jiaoyou.com\/style/admin/img/profile_small.jpg" width="64" height="64" /></span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                    <span class="block m-t-xs" style="margin:10px 0px"><strong class="font-bold"><?php echo htmlentities($admin['name']); ?></strong></span>
                                </span>
                            </a>

                        </div>
                        <div class="logo-element"><i class="fa fa-home"></i>
                        </div>
                    </li>
                    <?php 
                    $data=db('category')->where('tid',0)->order('des desc,id asc')->cache(_cache('db'))->select();
                    foreach($data as $k=>$v){
                        if(in_array($v['id'],$auth_visit)){
                     ?>
                        <li>
                            <?php 
                            $url='';
                            if($v['controller'] && $v['function']){
                                $url='class=J_menuItem href='.url($v['controller'].'/'.$v['function']);
                            }else{
                                $url='href=#';
                            }
                             ?>
                            <a <?php echo htmlentities($url); ?>>
                                <i class="fa fa-<?php echo htmlentities($v['icon']); ?>"></i>
                                <span class="nav-label"><?php echo htmlentities($v['title']); ?></span>
                                <?php 
                                    $data2=db('category')->where(['tid'=>$v['id'],'hideleft'=>1])->cache(_cache('db'))->order('des desc,id asc')->cache(_cache('db'))->select();
                                    if($data2){echo '<span class="fa arrow"></span>';}
                                 ?>
                            </a>
                            <?php 
                            if($data2){
                             ?>
                            <ul class="nav nav-second-level">
                                <?php 
                                foreach($data2 as $k2=>$v2){
                                    if(in_array($v2['id'],$auth_visit)){
                                 ?>
                                <li>
                                    <?php 
                                    $url='';
                                    if($v2['controller'] && $v2['function']){
                                        $url='class=J_menuItem href='.url($v2['controller'].'/'.$v2['function']);
                                    }else{
                                        $url='href=#';
                                    }
                                    $data3=db('category')->where(['tid'=>$v2['id'],'hideleft'=>1])->order('des asc,id asc')->select();
                                     ?>
                                    <a <?php echo htmlentities($url); ?>><?php echo htmlentities($v2['title']); if($data3){echo '<span class="fa arrow"></span>';} ?></a>
                                    <?php if($data3){ ?>
                                    <ul class="nav nav-third-level">
                                        <?php 
                                        foreach($data3 as $k3=>$v3){
                                         ?>
                                        <li>
                                            <a class="J_menuItem"  href="<?php echo url($v3['controller'].'/'.$v3['function']); ?>"><?php echo htmlentities($v3['title']); ?><?php echo htmlentities($v3['get']); ?></a>
                                        </li>
                                        <?php } ?>
                                    </ul>
                                    <?php } ?>
                                </li>
                                <?php 
                                    }
                                }
                                 ?>
                            </ul>
                            <?php } ?>
                        </li>
                    <?php 
                        }
                    }
                     ?>
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    </div>
                    <ul class="nav navbar-top-links navbar-right">
                        <li class="hidden-xs">
                            <a href="" class="J_menuItem cache">清空缓存</a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row content-tabs">
                <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs J_menuTabs">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" data-id="<?php echo url('main'); ?>">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
                </button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                    </button>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
                        <li class="J_tabShowActive"><a>定位当前选项卡</a>
                        </li>
                        <li class="divider"></li>
                        <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                        </li>
                        <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                        </li>
                    </ul>
                </div>
                <a href="<?php echo url('index/out'); ?>" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="<?php echo url('main'); ?>" frameborder="0" data-id="<?php echo url('main'); ?>" seamless></iframe>
            </div>

            <div class="footer">
                <div class="pull-right">
                    <p>
                        技术支持：<a target="_blank" href="http://www.duoduoxia.cn/">多多侠网络</a>
                        <?php if(sysConfig('beian')): ?>
                        备案号：<a target="_blank" href="http://www.miibeian.gov.cn/"><?php echo sysConfig('beian'); ?></a>
                        <?php endif; ?>
                    </p>
                </div>
            </div>

            <!--右侧部分结束-->
            <!--<div id="small-chat">
                <span class="badge badge-warning pull-right">5</span>
                <a class="open-small-chat">
                    <i class="fa fa-comments"></i>
                </a>
            </div>-->
        </div>
    </div>
    <?php if($is_customer_service): ?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>客服账号</title>

    <link rel="stylesheet" href="http://jiaoyou.com\/style/layim/css/layui.css">
    <style>
        html{background-color: #333;}
    </style>
</head>
<body>

<script src="http://jiaoyou.com\/style/layim/layui.js"></script>
<script src="http://jiaoyou.com\/style/webim/md5.js"></script>
<script src="http://jiaoyou.com\/style/webim/WebIMConfig.js"></script>
<script src="http://jiaoyou.com\/style/webim/websdk3.1.4.js"></script>
<script>

    if(!/^http(s*):\/\//.test(location.href)){
        //alert('请部署到localhost上查看该演示');
    }

    var myUserId="<?php echo htmlentities($customer_service_member['id']); ?>";
    var myUserName="<?php echo htmlentities($customer_service_member['nickname']); ?>";
    var myAvatar="<?php echo htmlentities($customer_service_member['avatar']); ?>";

    layui.use('layim', function(layim){
        WebIM.config=webimconfig;
        WebIM.conn = new WebIM.connection({
            appKey: "<?php echo htmlentities($easemob['app_key']); ?>",
            isHttpDNS: WebIM.config.isHttpDNS,
            isMultiLoginSessions: WebIM.config.isMultiLoginSessions,
            host: WebIM.config.Host,
            https: WebIM.config.https,
            url: WebIM.config.xmppURL,
            apiUrl: WebIM.config.apiURL,
            isAutoLogin: false,
            heartBeatWait: WebIM.config.heartBeatWait,
            autoReconnectNumMax: WebIM.config.autoReconnectNumMax,
            autoReconnectInterval: WebIM.config.autoReconnectInterval,
            isStropheLog: WebIM.config.isStropheLog,
            delivery: WebIM.config.delivery
        });
        //注册IM 回调
        WebIM.conn.listen({
            onOpened: function (message) {          //连接成功回调
                console.log("[opened] 连接已成功建立", "color: green");
            },
            onClosed: function (message) {
                console.log("hx退出登陆");

            },         //连接关闭回调
            onTextMessage: async function (message) {
                console.log('收到文本消息: ', message);
                im.defineMessage(message,'Text');
            },    //收到文本消息
            onEmojiMessage: function (message) {
                console.log('onEmojiMessage: ', message);
            },   //收到表情消息
            onPictureMessage: function (message) {
                console.log('onPicMessage: ', message);
                im.defineMessage(message,'Picture');
            }, //收到图片消息
            onCmdMessage: function (message) {
                console.log('onCmdMessage: ', message);
            },     //收到命令消息
            onAudioMessage: function (message) {
            },   //收到音频消息
            onLocationMessage: function (message) {
                console.log('onLocMessage: ', message);
                // rthis.sendChatLocalNotify(message);
                // rthis.hx_savemsg(message);
            },//收到位置消息
            onFileMessage: function (message) {
                console.log('onFileMessage: ', message);
            },    //收到文件消息
            recallMessage: function (message) {
                console.log('recallMessage', message);
            }, //消息撤回
            onVideoMessage: function (message) {
            },   //收到视频消息
            onPresence: function (message) {

            },       //处理“广播”或“发布-订阅”消息，如联系人订阅请求、处理群组、聊天室被踢解散等消息
            onRoster: function (message) {
            },         //处理好友申请
            onInviteMessage: function (message) {
                console.log('Invite');
            },  //处理群组邀请
            onOnline: function () {
                console.log("onOnline");
            },                  //本机网络连接成功
            onOffline: function () {
                console.log('offline');
            },                 //本机网络掉线
            onError: function (message) {
                console.log('onError: ', message);

            },          //失败回调
            onBlacklistUpdate: function (list) {       //黑名单变动
                                                       // 查询黑名单，将好友拉黑，将好友从黑名单移除都会回调这个函数，list则是黑名单现有的所有好友信息
                console.log(list);
            },
            onReceivedMessage: function (message) {
                console.log('onReceivedMessage: ', message);
            },    //收到消息送达服务器回执
            onDeliveredMessage: function (message) {
                console.log('onDeliveredMessage：', message);
            },   //收到消息送达客户端回执
            onReadMessage: function (message) {
                console.log('onReadMessage: ', message);
            },        //收到消息已读回执
            onCreateGroup: function (message) {
                console.log('onCreateGroup: ', message);
            },        //创建群组成功回执（需调用createGroupNew）
            onMutedMessage: function (message) {
                console.log('onMutedMessage: ', message);
            }         //如果用户在A群组被禁言，在A群发消息会走这个回调并且消息不会传递给群其它成员
        });
        //登录hx
        var options = {
            apiUrl: WebIM.config.apiURL,
            user: myUserId,
            pwd: md5(myUserId+"aawwff"),
            appKey: WebIM.config.appkey
        };
        WebIM.conn.open(options);

        var im = {
            //自定义消息，把消息格式定义为layim的消息类型
            defineMessage: function (message,msgType) {
                var msg;
                switch (msgType)
                {
                    case 'Text': msg = message.data;break;
                    case 'Picture': msg = 'img['+message.url+']';break;
                    // case 'Audio': msg = 'audio['+message.audio+']';break;
                    // case 'File': msg = 'file('+message.url+')['+message.filename+']';break;
                    // case 'Video': msg = 'video['+message.video+']';break;
                };

                if (message.type == 'chat') {
                    var type = 'friend';
                    var id = message.from;
                }
                if (message.delay){
                    var timestamp = Date.parse(new Date(message.delay));
                }else{
                    var timestamp = (new Date()).valueOf();
                }
                var data = {mine: false,cid: 0,username:message.ext.nickname,avatar:message.ext.avatar,content:msg,id:id,fromid: message.from,timestamp:timestamp,type:type}
                if (!message.ext.cmd) {layim.getMessage(data); };

            },
            sendMsg: function (data) {  //根据layim提供的data数据，进行解析
                var id = WebIM.conn.getUniqueId();
                var content = data.mine.content;

                if(/(^img\[)|(\]$)/g.test(content)) return; //图片消息就环信这里不发了


                var msg = new WebIM.message('txt', id);    // 创建文本消息

                msg.set({
                    msg: content,
                    to: data.to.id,
                    roomType: false,
                    ext:{
                        type: 0,
                        // msg_type:9,
                        nickname:data.mine.username,
                        avatar:data.mine.avatar
                    },
                    success: function (id, serverMsgId){
                        var sendData = {to:data.to.id,content:content,sendTime: data.mine.timestamp,type:data.to.type};
                    },
                    fail:function(e){
                        layer.msg('发送失败 刷新页面试试！');
                    }
                });
                if (data.to.id == data.mine.id){
                    layer.msg('不能给自己发送消息');
                    return;
                }
                if (data.to.cmd){
                    msg.body.ext.cmd = data.to.cmd;
                }
                WebIM.conn.send(msg.body);
            },
            getChatLog: function (data){

            }

        };



//基础配置
        layim.config({

            //初始化接口
            // init: {
            //     url: 'http://jiaoyou.com\/style/layim/demo_json/getList.json'
            //     ,data: {}
            // }

            //或采用以下方式初始化接口
            init: {
                mine: {
                    "username": myUserName //我的昵称
                    ,"id": myUserId //我的ID
                    ,"status": "online" //在线状态 online：在线、hide：隐身
                    ,"remark": "在深邃的编码世界，做一枚轻盈的纸飞机" //我的签名
                    ,"avatar": myAvatar
                }
                ,friend: []
                ,group: []
            }

            //上传图片接口
            ,uploadImage: {
                url: '/admin/file/sendCustomerServiceImg' //（返回的数据格式见下文） //直接发送完毕图片包括环信消息
                ,type: '' //默认post
            }

            // //上传文件接口
            // ,uploadFile: {
            //     url: '/upload/file' //（返回的数据格式见下文）
            //     ,type: '' //默认post
            // }
            ,initSkin: '5.jpg' //1-5 设置初始背景
            ,isfriend: false //是否开启好友
            ,isgroup: false //是否开启群组
            ,isAudio:false
            ,isVideo:false
            ,notice: true //是否开启桌面消息提醒，默认false
            // ,msgbox: layui.cache.dir + 'css/modules/layim/html/msgbox.html' //消息盒子页面地址，若不开启，剔除该项即可
            ,chatLog: layui.cache.dir + 'css/modules/layim/html/chatlog.html' //聊天记录页面地址，若不开启，剔除该项即可

        });

        //演示自动回复
        var autoReplay = [
            '您好，我现在有事不在，一会再和您联系。',
            '你没发错吧？face[微笑] ',
            '洗澡中，请勿打扰，偷窥请购票，个体四十，团体八折，订票电话：一般人我不告诉他！face[哈哈] ',
            '你好，我是主人的美女秘书，有什么事就跟我说吧，等他回来我会转告他的。face[心] face[心] face[心] ',
            'face[威武] face[威武] face[威武] face[威武] ',
            '<（@￣︶￣@）>',
            '你要和我说话？你真的要和我说话？你确定自己想说吗？你一定非说不可吗？那你说吧，这是自动回复。',
            'face[黑线]  你慢慢说，别急……',
            '(*^__^*) face[嘻嘻] ，是贤心吗？'
        ];

        //监听在线状态的切换事件
        layim.on('online', function(data){
            console.log(data);
        });

        //监听签名修改
        layim.on('sign', function(value){
            console.log(value);
        });

        //监听layim建立就绪
        layim.on('ready', function(res){
            // layim.msgbox(5); //模拟消息盒子有新消息，实际使用时，一般是动态获得
        });

        //监听发送消息
        layim.on('sendMessage', function(data){
            // console.log('发送消息');

            im.sendMsg(data);
        });

        //监听聊天窗口的切换
        layim.on('chatChange', function(res){
        });
    });
</script>
</body>
</html>
<?php endif; ?>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/hplus.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/contabs.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/pace/pace.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.css" />
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript">
        $('.cache').click(function(){

            var layerindex = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            $.getJSON("<?php echo url('cache_del'); ?>",function(result){
                $.each(result, function(i, name){
                    console.log(name);
                    swal(name);
                });
                layer.close(layerindex);
            });
        })
        $('.zhuan').click(function(){

            var layerindex = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            $.getJSON("<?php echo url('jinbi'); ?>",function(result){
                $.each(result, function(i, name){
                    swal(name);
                });
                layer.close(layerindex);
            });
        })
    </script>
</body>
</html>